package books;

import java.util.Scanner;

public class Person {
    private String name;
    public Person(String name){
        this.name=name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {

        this.name = name;
    }

    //购买书的功能
    public Book buyBook(Book[] books){
        Book book1=null;
        System.out.println("请输入购书的编号");
        Scanner sc=new Scanner(System.in);
        int id=sc.nextInt();
        for(int i=0;i<books.length;i++){
            Book book2=books[i];
            if(book2.getId()==id){
                book1=book2;
                break;
            }
        }
        return book1;
    }
}
